/*
 * =====================================================================================
 *
 *       Filename:  Main.cpp
 *
 *    Description:  *
 *        Version:  1.0
 *        Created:  2015年03月27日 23时09分09秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  LiuYi (), swliuyi@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <limits.h>
#include <iostream>
#include "Text.h"
#include "TextFactory.h"
#include "CodeDetector.h"
#include "LM.h"
#include "WordLM.h"
#include "LangDetector.h"
#include "Config.h"

using namespace std;
int main(int argc, char *argv[])
{
    string path ="/home/liuyi/workspace/job/languagedetection/test/russian"; 
    string code =  CodeDetector::CodeDetect(path);
    string charPath = "/home/liuyi/workspace/job/languagedetection/CodeDect3.0/CodeDectNew/config/characters/EYU.utf8";
    Text * t = TextFactory::CreateText(code, path);
    cout<<code<<endl;


    string lmpath = "/home/liuyi/workspace/job/languagedetection/CodeDect3.0/CodeDectNew/config/LMResource/eyu.byte.gz";

    LangDetector * ld = new LangDetector("法语", code, charPath, lmpath, 3);

    for( int i = 0 ; i < t->SentSize() ; i++ )
    {
        string tmp;
        for( int j = 0 ; j < ((*t)[i]).size() ; j++ )
        {
            tmp += (*t)[i][j];
        }
        cout<<tmp<<endl;
        cout<<ld->ComputeLMScore(tmp, 3)<<endl;
        cout<<ld->ComputeCharScore((*t)[i])<<endl;
    }
    
    delete t;
    delete ld;

    Config * config = new Config("/home/liuyi/workspace/job/languagedetection/NewVersion/src/config");
    delete config;
}
